package com.thread.test13;

/**
 * 男孩
 * @author bin
 * @date 2025 - 03 -14
 **/
public class BoyThread extends Thread{
    private Box box;

    private String name;

    public BoyThread() {
    }

    public BoyThread(Box box, String name) {
        this.box = box;
        this.name = name;
    }

    @Override
    public void run() {
        while (true){
            Fruit fruit = new Fruit();
            try {
                box.put(name,fruit);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
